{% extends "base.html" %}
{% block title %}{{group['name']}} details{% endblock %}
{% block content %}
    <article id="main" class="markdown-section">
	<h1>{{group['name'].title()}}</h1>
        {% if group['name'].lower() in parser %}
        <p><em>parsing : <code>enabled</code></em></p>
        {% endif %} 
        {% if group['meta'] is not none %}
        <h4>Description</h4>
        <p>{{group['meta']|safe}}</p>
        {% endif %}
        {% if group['profile'][0] %}
        <table id="table" class="table" style="display:table; table-layout:auto; width:100%">
          <thead>
            <tr>
                <th> External Analysis </th>
            </tr>
          </thead>
          <tbody>
          {% for profile in group['profile'] %}
          <tr><td>{{profile}}</td></tr>
          {% endfor %}
          </tbody>
        </table>
        {% endif %}

        <table id="table" class="table" style="display:table; table-layout:auto; width:100%">
          <thead>
            <tr>
                <th>Urls</th>
                <th style="width:10%" ><center>Screen</center></th>
            </tr>
          </thead>
          <tbody>
        {% for location in group['locations'] %}
          {% if current_user.is_authenticated or not 'private' in location or location['private'] is false %}
            {% if not 'fs' in location or location['fs'] is false %}
            <tr><td> {{location['slug']}} </td>
                {% if 'screen' in location %}
                <td><center><a href="{{ location['screen'] }}" rel="noopener noreferrer" target="_blank">Screen</a></center></td>
                {% else %}
                <td> </td>
                {% endif %}
            </tr>
            {% endif %}
          {% endif %}
        {% endfor %}
          </tbody>
        </table>

        <table id="table" class="table" style="display:table; table-layout:auto; width:100%">
          <thead>
            <tr>
                <th>File servers</th>
                <th style="width:10%" ><center>Screen</center></th>
            </tr>
          </thead>
          <tbody>
        {% for location in group['locations'] %}
          {% if current_user.is_authenticated or not 'private' in location and location['private'] is false %} 
            {% if 'fs' in location and location['fs'] is true %}
            <tr><td> {{location['slug']}} </td>
                {% if 'screen' in location %}
                <td><center><a href="{{ location['screen'] }}" rel="noopener noreferrer" target="_blank">Screen</a></center></td>
                {% else %}
                <td> </td>
                {% endif %}
            </tr>
            {% endif %}
          {% endif %}
        {% endfor %}
          </tbody>
        </table>
        {% if posts %}
        <center><img src="/stats/{{ group['name'] }}.png"></center>
        
        <h4>Posts</h4>
        <table id="table" class="table" style="display:table; table-layout:auto; width:100%">
          <thead>
            <tr>
                <th style="width:10%"> Date </th>
                <th style="width:25%"> Title </th>
                <th style="word-break:break-all width:55%"> Description </th>
                <th style="width:10%"> Screen </th>
            </tr>
          </thead>
          <tbody>
            {% for entry in posts %}
                <tr>
                    <td><center> {{entry['discovered'].split(' ')[0]}} </center></td>
                    <td> {{entry['post_title']}} </td>
                    {% if entry['description'] is not none %}
                    <td style="word-break:break-all"> {{entry['description']}} </td>
                    {% else %}
                    <td> </td>
                    {% endif %}
                    
                    {% if 'screen' in entry and entry['screen'] is not none %}
                    <td><center><a href="/{{ entry['screen']|quote_plus }}" rel="noopener noreferrer" target="_blank">Screen</a></center></td>
                    {% else %}
                    <td> </td>
                    {% endif %}

                </tr>
            {% endfor %}
          </tbody>
        </table>
        {% endif %}
    </article>
{% endblock %}
